package com.tony.blog.model.mapper;

import com.tony.blog.model.entity.PraiseEntity;
import org.apache.ibatis.annotations.Param;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 *
 * @Title: PraiseMapper
 * @Auther: 皮蛋布丁
 * @Date: 2021/08/16/20:29
 * @Description: 点赞表
 */
public interface PraiseMapper {

    /**
    * @Description: countByUBlogId 根据博文id获取被点赞的数量
    * @Param: [blogId, userId]
    * @return: java.lang.Integer
    * @Author: 皮蛋布丁
    * @Date: 2021/8/16 20:30
    */
    Integer countByUBlogId(@Param("blogId") Integer blogId, @Param("userId") Long userId);

    /**
    * @Description: selectByUserBlogId 获取点赞信息
    * @Param: [blogId, userId]
    * @return: com.tony.blog.model.entity.PraiseEntity
    * @Author: 皮蛋布丁
    * @Date: 2021/8/30 16:06
    */
    PraiseEntity selectByUserBlogId(@Param("blogId") Integer blogId,@Param("userId") Long userId);

    /**
    * @Description: updateByPraimaryKeySelective 更新点赞信息为正常
    * @Param: [praise]
    * @return: java.lang.Integer
    * @Author: 皮蛋布丁
    * @Date: 2021/8/30 16:13
    */
    Integer updateByPraimaryKeySelective(PraiseEntity praise);

    /**
    * @Description: insertSelective 新增点赞信息
    * @Param: [praise]
    * @return: java.lang.Integer
    * @Author: 皮蛋布丁
    * @Date: 2021/8/30 16:28
    */
    Integer insertSelective(PraiseEntity praise);

    /**
    * @Description: PraiseCancel 取消点赞
    * @Param: [blogId, userId]
    * @return: java.lang.Integer
    * @Author: 皮蛋布丁
    * @Date: 2021/8/30 22:11
    */
    Integer PraiseCancel(@Param("blogId") Integer blogId,@Param("userId") Long userId,@Param("updateTime") Date time);
}
